#pragma once
/*--- Base Classes ---*/
/*--- User Generated ---*/
#include "dice.h"
#include "global.h"
#include "scoring.h"
/*--- SDL ---*/
//#include "SDL.h"
//#include "SDL_ttf.h"
#include "sdl\include\SDL.h"
#include "sdl\include\SDL_ttf.h"

/*--- Enums ---*/
enum PlayerState{
	PLAYER_IDLE, PLAYER_ROLL, PLAYER_SCORE
};
/*---  ---*/

class Player
{
public:
	/*--- Constructor/Destructor ---*/
	Player();
	~Player();
	/*--- Base Game Functions ---*/
	void initialize(int a_index, int a_state, SDL_Color a_color, TTF_Font * a_font);
	// draws to the screen
	void draw(SDL_Surface * a_buffer);
	// update game logic and information
	void update(SDL_Surface * a_buffer, Position a_position);
	/*--- Main Game Functions ---*/
	// checks if all dice are frozen
	bool allFrozen();
	// check if all scores are filled
	bool allScored();
	// returns if the score has been clicked
	bool isScoreClicked(Position a_position, int a_w);
	// rolls all unfrozen dice
	void diceRollAll();
	// freezes the dice value when re rolling
	void freezeDiceValue(int a_index);
	// check if a score is entered for the current round.
	bool roundScored(int a_gRound);
	// unfreezes all dice
	void unFreezeAll();
	/*--- Accessors/Mutators ---*/
	// these are set in the initialization function once player is created
	void setColor(SDL_Color a_color) { uiTextColor = a_color; }
	void setFont(TTF_Font * a_font) { font = a_font; }
	void setIndex(int a_index) { index = a_index; }
	void setGameState(int a_state) { pState = (PlayerState)a_state; }
	void setScoreClick(int a_index) { scoreClick = a_index; }

private:
	/*--- SDL Variables ---*/
	SDL_Rect textRect;
	// Player text
	SDL_Surface * textSurface;
	// player number
	SDL_Surface * pNumSurface;
	SDL_Color uiTextColor;
	TTF_Font * font;

	/*--- Member Variables ---*/
	// grand total score of the game
	int totalScore;
	// player number
	int index;
	int pNum;
	// current state
	PlayerState pState;
	// current score card clicked
	int scoreClick;

	/*--- Class Variables ---*/
	Dice * dice;
	ScoreDice score;
	/*--- Sub-Functions ---*/
};